﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MVCBugTracker.ViewModels.BugIndexViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="activeprojectdisplay">
        <% Html.RenderPartial("ActiveProject"); %>
    </div>
    <p>
        <%: Html.ActionLink("Create Bug", "Create", "Bug", new { projectID = Model.ActiveProjectID }, new { @class = "button" })%>
    </p>
    <br />
    <table style="width: 100%">
        <tr>
            <th>
                Bug ID
            </th>
            <th style="width: 25%">
                Title
            </th>
            <th>
                Category
            </th>
            <th>
                Milestone
            </th>
            <th>
            </th>
            <th>
                Priority
            </th>
            <th>
            </th>
            <th>
                Status
            </th>
            <th>
            </th>
            <th>
                Creator
            </th>
            <th>
                Assigned
            </th>
            <th>
                Created
            </th>
            <th>
                Last Update
            </th>
        </tr>
        <% foreach (var item in Model.Bugs)
           { %>
        <tr>
            <td style="text-align: center">
                <%: Html.ActionLink(item.BugID.ToString(), "Edit", new { id=item.BugID }) %>
            </td>
            <td>
               <b> <%: item.Title %> </b>
            </td>
            <td>
                <% if (item.ProjectCategory != null)
                   {  %>
                <%: item.ProjectCategory.Name %>
                <% } %>
            </td>
            <td>
                <% if (item.ProjectMilestone != null)
                   {  %>
                <%: item.ProjectMilestone.Name %>
                <% } %>
            </td>
            <td>
                <% if (item.ProjectMilestone != null)
                   {  %>
                <img src="<%: ResolveUrl(item.ProjectMilestone.ImageUrl) %>" alt="" />
                <% } %>
            </td>
            <td>
                <% if (item.ProjectPriority != null)
                   {  %>
                <%: item.ProjectPriority.Name%>
                <% } %>
            </td>
            <td>
                <% if (item.ProjectPriority != null)
                   {  %>
                <img src="<%: ResolveUrl(item.ProjectPriority.ImageUrl) %>" alt="" />
                <% } %>
            </td>
            <td>
                <% if (item.ProjectStatus != null)
                   {  %>
                <%: item.ProjectStatus.Name %>
                <% } %>
            </td>
            <td>
                <% if (item.ProjectStatus != null)
                   {  %>
                <img src="<%: ResolveUrl(item.ProjectStatus.ImageUrl) %>" alt="" />
                <% } %>
            </td>
            <td>
                <%: item.CreatorUserName %>
            </td>
            <td>
                <%: item.AssignedUserName %>
            </td>
            <td>
                <%: String.Format("{0:g}", item.DateCreated) %>
            </td>
            <td>
                <%: String.Format("{0:g}", item.LastUpdate) %>
            </td>
        </tr>
        <% } %>
    </table>
</asp:Content>
